package com.mccrea.pattern.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @Classname University
 * @Description 大学
 * @Date 2021/5/10 0010 10:09
 * @Created by Mccrea_Gao
 */
public class University extends OrganizationComponent{

    List<OrganizationComponent> organizationComponents = new ArrayList<>();

    public University(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    protected void print() {
        System.out.println("===============" + getName() + "===============");
        organizationComponents.forEach(OrganizationComponent::print);
    }
}
